
<table width="100%" rules="all" border="1" cellpadding="0" cellspacing="0" >
<thead>
<tr>
<th>ID Proveedor</th>
<th>Raz&oacute;n Social</th>
<th>Direccion</th>
<th>Nro.Ident.Fiscal</th>
<th>Nom.Contacto</th>
<th>Creador por</th>
</tr>
</thead>
<tbody>
<?php
 include('../../Connections/KRAPPERCON.php');
$oper = $_POST['oper'];

$noms = $_POST['t_lp_noms'];
$nif = $_POST['t_lp_nif'];
$con = $_POST['t_lp_con'];

$str_noms = isNull($noms,"and ProveedRaz like '%".$noms."%'");
$str_nif = isNull($nif,"and ProveedNIF like '%".$nif."%'");

$str_con = isNull($con,"and ContactoNom like '%".$con."%'");

$where = $str_noms.$str_nif.$str_con;
	if (trim($where)!= '' ){
		$where = 'where '.substr(ltrim($where),3);
	}



$sql = "
SELECT
ProveedID,
ProveedNom,
ProveedRaz,
ProveedNIF,
ProveedSort1,
ProveedDir,
ProveedSts,
UbigeoID,
UserID,
ContactoNom,
ContactoCar,
ProveedFeCr
FROM vt_proveedor ".$where." order by ProveedID";
doEcho($sql);
//doEcho($sql);
$a1 = '';
$a2 = '';
$sub = '';
if (isset($_POST['finder'])){
	$sub = $_POST['finder'];
	if (trim($sub)!="") {
	$a2 = '</a>';
	$a1 = '<a class="a" href="#" onclick="selCliPed(this)">';
	}
}

$res = $mysqli->query($sql);
if ($res){
	while($row = $res->fetch_assoc()){
	echo "<tr>
	<td>".$a1.$row['ProveedID'].$a2."</td>
    <td class='b'>".$row['ProveedRaz']."&nbsp;</td>
	<td class='c'>".$row['ProveedDir']."</td>
	<td class='d'>".$row['ProveedNIF']."</td>  
	<td>".$row['ContactoNom']."</td>
	<td>".$row['UserID']."</td>
	</tr>";
	}
$res->close();
$mysqli->check_result();
}
/*
t_lc_noms : GEBI('t_lc_noms').value,
		t_lc_apat : GEBI('t_lc_apat').value,
		t_lc_amat : GEBI('t_lc_amat').value,
		t_lc_dir : GEBI('t_lc_dir').value,
		t_lc_nif : GEBI('t_lc_nif').value,
		t_lc_dir : GEBI('t_lc_dir').value,
		t_lc_con : GEBI('t_lc_con').value
*/
?>
</tbody>
</table>
<script type="text/javascript">
	function selCliPed(obj){
		<?php 
		if (trim($sub)!="") {
		?>
		var fila = $(obj).parent().parent();
		obj = {id:fila.find('.a').text(),
						nom:fila.find('.b').text(),
						dir:fila.find('.c').text(),
						nif:fila.find('.d').text()};
		<?php 		
		echo $sub.'(obj);';
		?>
		<?php if (getVal('noClose')=='') 
		echo "closePopup();"; 
		}
		?>
	}
</script>